<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')

			this.getHeight()
			uni.removeStorageSync('hasShow')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},

		methods: {
			//获取屏幕导航栏高度
			getHeight() {
				if (uni.canIUse('getMenuButtonBoundingClientRect')) {
					let sysInfo = uni.getSystemInfoSync();
					//状态栏的高度
					let statusBarHeight = sysInfo.statusBarHeight

					// 胶囊位置信息
					let rect = uni.getMenuButtonBoundingClientRect();

					// 导航栏高度
					let navBarHeight = (rect.top - sysInfo.statusBarHeight) * 2 + rect.height;

					// 自定义导航栏的高度
					let height = sysInfo.statusBarHeight + navBarHeight;

					let data = {
						statusBarHeight: statusBarHeight,
						rect: rect,
						navBarHeight: navBarHeight,
						height: height,
					}
					uni.setStorageSync('navHeight', data)
				} else {
					uni.showToast({
						title: '您的微信版本过低，界面可能会显示不正常',
						icon: 'none',
						duration: 4000
					});
				}
			},
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";

	/*每个页面公共css */
	page {
		/* background-color: #dafadd; */
		background-color: #F7F7F7;
	}
</style>